package com.farm.shiro.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.farm.common.entity.NumericalEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "账户")
@TableName(value = "Account", keepGlobalPrefix = true)
public class Account extends NumericalEntity {

    public Account(String username, String password) {
        this.username = username;
        this.password = password;
    }

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 最后登录时间
     */
    private LocalDateTime loginLastTime = LocalDateTime.now();

    /**
     * 是否启用 (0 禁用, 1 启用)
     */
    private boolean enabled = true;

    /**
     * 账户所属角色, 瞬态属性
     */
    private transient List<Role> roles;

}
